package com.zy.test.widget

import android.content.Intent
import com.zy.activity.BaseMenuActivity
import com.zy.activity.bean.BaseMenuBean
import com.zy.test.widget.popup_window.PopupWindowTestActivity
import com.zy.test.widget.view.*

class ViewTestListMainActivity : BaseMenuActivity() {

    override fun init(list: ArrayList<BaseMenuBean>) {
        list.add(BaseMenuBean("View体系"))
        list.add(BaseMenuBean("View工作原理"))
        list.add(BaseMenuBean("View事件体系"))
        list.add(BaseMenuBean("View的坐标体系", ViewCoordinateFragment::class.java))
        list.add(BaseMenuBean("View的事件分发(ScrollView )", ViewEventHandle01Fragment::class.java))

        list.add(BaseMenuBean("自定义View"))
        list.add(BaseMenuBean("Canvas绘制001(基础)", DIYView001Fragment::class.java))
        list.add(BaseMenuBean("Canvas绘制002(空心)", DIYView002Fragment::class.java))
        list.add(BaseMenuBean("Canvas绘制003(表格)", DIYView003Fragment::class.java))
        list.add(BaseMenuBean("Canvas绘制003(拖动)", DIYView004Fragment::class.java))

        list.add(BaseMenuBean("PopupWindow"))
        list.add(BaseMenuBean("PopupWindow", 20))

        //模拟测试
        //clickItem(BaseMenuBean("Canvas绘制", DIYView004Fragment::class.java))
    }

    override fun clickItem(bean: BaseMenuBean) {
        if (bean.code == 20) {
            startActivity(Intent(this, PopupWindowTestActivity::class.java))
        } else {
            val intent = Intent(this, ViewTestMainActivity::class.java)
            intent.putExtra("code", bean.code)
            intent.putExtra("targetClass", bean.targetClass)
            startActivity(intent)
        }
    }
}